{extend name="common/base" /} {block name="titlekeyword"}
<title>{$content}</title>

{/block}

{block name="headjs"}
<script language="javascript">
	window.onload = function () {
		var num1 = window.prompt("请输入第一个数");
		var num2 = window.prompt("请输入第二个数");
		var operator = window.prompt("请输入运算符");
		num1 = parseFloat(num1);
		num2 = parseFloat(num2);
		var res = 0;
		if (operator == "+") {
			alert(num1);
			alert(num2);
			res = num1 + num2;
		} else if (operator == "-") {
			res = num1 - num2;
		}
		document.write("res=" + res);

	}

</script> {/block}



{block name="main"}
<h6>内容</h6>
<h6>代码</h6>
<pre>
		&lt;script language="javascript"&gt;
		window.onload = function () {         // 重新加载
			var num1 = window.prompt("请输入第一个数");
			var num2 = window.prompt("请输入第二个数");
			var operator = window.prompt("请输入运算符");
			num1 = parseFloat(num1);
			num2 = parseFloat(num2);
			var res = 0;
			if (operator == "+") {
				alert(num1);
				alert(num2);
				res = num1 + num2;
			} else if (operator == "-") {
				res = num1 - num2;
			}
			document.write("res=" + res); // 写入浏览器
	
		}
	
	&lt;/script&gt;

	 </pre> {/block} 